package com.fg.common.enums;

import com.fg.common.response.Response;
import com.fg.common.response.ResponseCodeConstant;
import com.fg.common.response.ResponseMessageConstant;

/**
 * 统一返回枚举类
 * @author lv
 * @version 1.0.0
 */

public enum ResponseEnum implements Response {

    /**
     * 成功
     */
    SUCCESS(ResponseCodeConstant.SUCCESS, ResponseMessageConstant.SUCCESS),

    /**
     * 错误
     */
    ERROR(ResponseCodeConstant.UNKNOWN, ResponseMessageConstant.ERROR),

    /**
     * token为空异常
     */
    TOKEN_IS_NULL(ResponseCodeConstant.AUTHORIZATION_TOKEN_IS_NULL, ResponseMessageConstant.AUTHORIZATION_TOKEN_IS_NULL),

    /**
     * token失效异常
     */
    TOKEN_INVALID(ResponseCodeConstant.AUTHORIZATION_TOKEN_INVALID, ResponseMessageConstant.AUTHORIZATION_TOKEN_INVALID),

    /**
     * 用户为空异常
     */
    USER_IS_NULL(ResponseCodeConstant.USER_IS_NULL, ResponseMessageConstant.USER_IS_NULL),

    /**
     * 未授权异常
     */
    UNAUTHORIZED(ResponseCodeConstant.AUTHORIZED_UNAUTHORIZED, ResponseMessageConstant.AUTHORIZED_UNAUTHORIZED),

    /**
     * 登录模块---用户名/密码错误
     */
    LOGIN_FAIL(ResponseCodeConstant.LOGIN_FAIL, ResponseMessageConstant.LOGIN_FAIL),

    /**
     * 登录模块---用户被锁定
     */
    LOGIN_USER_LOCK(ResponseCodeConstant.LOGIN_USER_LOCK, ResponseMessageConstant.LOGIN_USER_LOCK),

    /**
     * 图形验证码失效
     */
    CODE_GRAPH_INVALID(ResponseCodeConstant.CODE_GRAPH_INVALID, ResponseMessageConstant.CODE_INVALID),

    /**
     * 图形验证码没找到
     */
    CODE_GRAPH_NOT_FOUND(ResponseCodeConstant.CODE_GRAPH_NOT_FOUND, ResponseMessageConstant.CODE_NOT_FOUND),

    /**
     * 图形验证码错误
     */
    CODE_GRAPH_ERROR(ResponseCodeConstant.CODE_GRAPH_ERROR, ResponseMessageConstant.CODE_ERROR),

    /**
     * 参数错误异常
     */
    PARAM_ERROR(ResponseCodeConstant.PARAM_ERROR, ResponseMessageConstant.PARAM_ERROR),

    /**
     * 数据库模块---记录已存在
     */
    DATABASE_EXIST_ERROR(ResponseCodeConstant.DATABASE_EXIST, ResponseMessageConstant.DATABASE_EXIST),

    /**
     * 数据库模块---记录不存在
     */
    DATABASE_NOT_EXIST_ERROR(ResponseCodeConstant.DATABASE_NOT_EXIST, ResponseMessageConstant.DATABASE_NOT_EXIST),

    /**
     * 权限模块---权限不足
     */
    AUTHORIZATION_INSUFFICIENT_ERROR(ResponseCodeConstant.AUTHORIZATION_INSUFFICIENT, ResponseMessageConstant.AUTHORIZATION_INSUFFICIENT),

    /**
     * 路径模块---找不到路径
     */
    PATH_NOT_FOUND(ResponseCodeConstant.PATH_NO_HANDLER, ResponseMessageConstant.PATH_NO_HANDLER);

    private final String code;

    private final String message;

    ResponseEnum(String code, String message){
        this.code = code;
        this.message = message;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
